<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Collectors: Maps of Sets</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Icl">
<link rel="up" href="../semantics.html" title="Semantics">
<link rel="prev" href="maps.html" title="Maps">
<link rel="next" href="quantifiers__maps_of_numbers.html" title="Quantifiers: Maps of Numbers">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="maps.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../semantics.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="quantifiers__maps_of_numbers.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section boost_icl_semantics_collectors__maps_of_sets" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_icl.semantics.collectors__maps_of_sets"></a><a class="link" href="collectors__maps_of_sets.html" title="Collectors: Maps of Sets">Collectors:
      Maps of Sets</a>
</h3></div></div></div>
<p>
        Icl <code class="computeroutput"><span class="identifier">Collectors</span></code>, behave like
        <code class="computeroutput"><span class="identifier">Sets</span></code>. This can be understood
        easily, if we consider, that every map of sets can be transformed to an equivalent
        set of pairs. For instance in the pseudocode below map <code class="computeroutput"><span class="identifier">m</span></code>
        
</p>
<pre class="programlisting"><span class="identifier">icl</span><span class="special">::</span><span class="identifier">map</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="identifier">set</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;</span>  <span class="identifier">m</span> <span class="special">=</span> <span class="special">{(</span><span class="number">1</span><span class="special">-&gt;{</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">}),</span> <span class="special">(</span><span class="number">2</span><span class="special">-&gt;{</span><span class="number">1</span><span class="special">})};</span> 
</pre>
<p>
        is equivalent to set <code class="computeroutput"><span class="identifier">s</span></code> 
</p>
<pre class="programlisting"><span class="identifier">icl</span><span class="special">::</span><span class="identifier">set</span><span class="special">&lt;</span><span class="identifier">pair</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">s</span> <span class="special">=</span> <span class="special">{(</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">),(</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">),</span>   <span class="comment">//representing 1-&gt;{1,2}
</span>                              <span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">)</span>       <span class="special">};</span> <span class="comment">//representing 2-&gt;{1}
</span></pre>
<p>
      </p>
<p>
        Also the results of add, subtract and other operations on <code class="computeroutput"><span class="identifier">map</span>
        <span class="identifier">m</span></code> and <code class="computeroutput"><span class="identifier">set</span>
        <span class="identifier">s</span></code> preserves the equivalence of
        the containers <span class="emphasis"><em><span class="bold"><strong>almost</strong></span></em></span>
        perfectly: 
</p>
<pre class="programlisting"><span class="identifier">m</span> <span class="special">+=</span> <span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">3</span><span class="special">);</span> 
<span class="identifier">m</span> <span class="special">==</span> <span class="special">{(</span><span class="number">1</span><span class="special">-&gt;{</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">}),</span> <span class="special">(</span><span class="number">2</span><span class="special">-&gt;{</span><span class="number">1</span><span class="special">})};</span> <span class="comment">//aggregated on collision of key value 1
</span><span class="identifier">s</span> <span class="special">+=</span> <span class="special">(</span><span class="number">1</span><span class="special">,</span><span class="number">3</span><span class="special">);</span>
<span class="identifier">s</span> <span class="special">==</span> <span class="special">{(</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">),(</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">),(</span><span class="number">1</span><span class="special">,</span><span class="number">3</span><span class="special">),</span>   <span class="comment">//representing 1-&gt;{1,2,3}
</span>      <span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">)</span>             <span class="special">};</span> <span class="comment">//representing 2-&gt;{1}
</span></pre>
<p>
      </p>
<p>
        The equivalence of <code class="computeroutput"><span class="identifier">m</span></code> and
        <code class="computeroutput"><span class="identifier">s</span></code> is only violated if an
        empty set occurres in <code class="computeroutput"><span class="identifier">m</span></code> by
        subtraction of a value pair: 
</p>
<pre class="programlisting"><span class="identifier">m</span> <span class="special">-=</span> <span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">);</span> 
<span class="identifier">m</span> <span class="special">==</span> <span class="special">{(</span><span class="number">1</span><span class="special">-&gt;{</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">}),</span> <span class="special">(</span><span class="number">2</span><span class="special">-&gt;{})};</span> <span class="comment">//aggregated on collision of key value 2
</span><span class="identifier">s</span> <span class="special">-=</span> <span class="special">(</span><span class="number">2</span><span class="special">,</span><span class="number">1</span><span class="special">);</span>
<span class="identifier">s</span> <span class="special">==</span> <span class="special">{(</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">),(</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">),(</span><span class="number">1</span><span class="special">,</span><span class="number">3</span><span class="special">)</span>   <span class="comment">//representing 1-&gt;{1,2,3}
</span>                       <span class="special">};</span> <span class="comment">//2-&gt;{} is not represented in s
</span></pre>
<p>
      </p>
<p>
        This problem can be dealt with in two ways.
      </p>
<div class="orderedlist"><ol type="1">
<li>
          Deleting value pairs form the Collector, if it's associated value becomes
          a neutral value or <code class="computeroutput"><span class="identifier">identity_element</span></code>.
        </li>
<li>
          Using a different equality, called distinct equality in the laws to validate.
          Distinct equality only accounts for value pairs that that carry values
          unequal to the <code class="computeroutput"><span class="identifier">identity_element</span></code>.
        </li>
</ol></div>
<p>
        Solution (1) led to the introduction of map traits, particularly trait <span class="emphasis"><em><span class="bold"><strong>partial_absorber</strong></span></em></span>, which is the default
        setting in all icl's map templates.
      </p>
<p>
        Solution (2), is applied to check the semantics of icl::Maps for the partial_enricher
        trait that does not delete value pairs that carry identity elements. Distinct
        equality is implemented by a non member function called <code class="computeroutput"><span class="identifier">is_distinct_equal</span></code>.
        Throughout this chapter distinct equality in pseudocode and law denotations
        is denoted as <code class="computeroutput"><span class="special">=</span><span class="identifier">d</span><span class="special">=</span></code> operator.
      </p>
<p>
        The validity of the sets of laws that make up <code class="computeroutput"><span class="identifier">Set</span></code>
        semantics should now be quite evident. So the following text shows the laws
        that are validated for all <code class="computeroutput"><span class="identifier">Collector</span></code>
        types <code class="computeroutput"><span class="identifier">C</span></code>. Which are <code class="computeroutput"><a class="link" href="../../boost/icl/map.html" title="Class template map">icl::map</a></code><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">D</span><span class="special">,</span><span class="identifier">S</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span></code>,
        <code class="computeroutput"><a class="link" href="../../boost/icl/interval_map.html" title="Class template interval_map">interval_map</a></code><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">D</span><span class="special">,</span><span class="identifier">S</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span></code> and <code class="computeroutput"><a class="link" href="../../boost/icl/split_interval_map.html" title="Class template split_interval_map">split_interval_map</a></code><code class="computeroutput"><span class="special">&lt;</span><span class="identifier">D</span><span class="special">,</span><span class="identifier">S</span><span class="special">,</span><span class="identifier">T</span><span class="special">&gt;</span></code> where <code class="computeroutput"><span class="identifier">CodomainT</span></code>
        type <code class="computeroutput"><span class="identifier">S</span></code> is a model of <code class="computeroutput"><span class="identifier">Set</span></code> and <code class="computeroutput"><span class="identifier">Trait</span></code>
        type <code class="computeroutput"><span class="identifier">T</span></code> is either <code class="computeroutput"><a class="link" href="../../boost/icl/partial_absorber.html" title="Struct partial_absorber">partial_absorber</a></code> or <code class="computeroutput"><a class="link" href="../../boost/icl/partial_enricher.html" title="Struct partial_enricher">partial_enricher</a></code>.
      </p>
<a name="boost_icl.semantics.collectors__maps_of_sets.laws_on_set_union__set_intersection_and_set_difference"></a><h6>
<a name="id1090371"></a>
        <a class="link" href="collectors__maps_of_sets.html#boost_icl.semantics.collectors__maps_of_sets.laws_on_set_union__set_intersection_and_set_difference">Laws
        on set union, set intersection and set difference</a>
      </h6>
<p>
        
</p>
<pre class="programlisting"><span class="identifier">Associativity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,==</span> <span class="special">&gt;:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span><span class="special">+(</span><span class="identifier">b</span><span class="special">+</span><span class="identifier">c</span><span class="special">)</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span><span class="special">)+</span><span class="identifier">c</span>
<span class="identifier">Neutrality</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,==</span> <span class="special">&gt;</span>   <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">;</span>       <span class="identifier">a</span><span class="special">+</span><span class="identifier">C</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">a</span>
<span class="identifier">Commutativity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,==</span> <span class="special">&gt;:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">;</span>       <span class="identifier">a</span><span class="special">+</span><span class="identifier">b</span> <span class="special">==</span> <span class="identifier">b</span><span class="special">+</span><span class="identifier">a</span>

<span class="identifier">Associativity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,&amp;,==</span> <span class="special">&gt;:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span><span class="special">&amp;(</span><span class="identifier">b</span><span class="special">&amp;</span><span class="identifier">c</span><span class="special">)</span> <span class="special">==(</span><span class="identifier">a</span><span class="special">&amp;</span><span class="identifier">b</span><span class="special">)&amp;</span><span class="identifier">c</span>
<span class="identifier">Commutativity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,&amp;,==</span> <span class="special">&gt;:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">;</span>       <span class="identifier">a</span><span class="special">&amp;</span><span class="identifier">b</span> <span class="special">==</span> <span class="identifier">b</span><span class="special">&amp;</span><span class="identifier">a</span>

<span class="identifier">RightNeutrality</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,-,==</span> <span class="special">&gt;:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">;</span>   <span class="identifier">a</span><span class="special">-</span><span class="identifier">C</span><span class="special">()</span> <span class="special">==</span>  <span class="identifier">a</span>
<span class="identifier">Inversion</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,-,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span>     <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">;</span>   <span class="identifier">a</span> <span class="special">-</span> <span class="identifier">a</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="identifier">C</span><span class="special">()</span>
</pre>
<p>
      </p>
<p>
        All the fundamental laws could be validated for all icl Maps in their instantiation
        as Maps of Sets or Collectors. As expected, Inversion only holds for distinct
        equality, if the map is not a <code class="computeroutput"><span class="identifier">partial_absorber</span></code>.
      </p>
<p>
        
</p>
<pre class="programlisting">                             <span class="special">+</span>    <span class="special">&amp;</span>    <span class="special">-</span>
<span class="identifier">Associativity</span>                <span class="special">==</span>   <span class="special">==</span> 
<span class="identifier">Neutrality</span>                   <span class="special">==</span>        <span class="special">==</span>
<span class="identifier">Commutativity</span>                <span class="special">==</span>   <span class="special">==</span>
<span class="identifier">Inversion</span> <span class="identifier">partial_absorber</span>             <span class="special">==</span>
          <span class="identifier">partial_enricher</span>             <span class="special">=</span><span class="identifier">d</span><span class="special">=</span>
</pre>
<p>
      </p>
<a name="boost_icl.semantics.collectors__maps_of_sets.distributivity_laws"></a><h6>
<a name="id1091034"></a>
        <a class="link" href="collectors__maps_of_sets.html#boost_icl.semantics.collectors__maps_of_sets.distributivity_laws">Distributivity
        Laws</a>
      </h6>
<p>
        
</p>
<pre class="programlisting">     <span class="identifier">Distributivity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,&amp;,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">&amp;</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> <span class="identifier">c</span><span class="special">)</span>
     <span class="identifier">Distributivity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,&amp;,+,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">+</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">&amp;</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">&amp;</span> <span class="identifier">c</span><span class="special">)</span>
<span class="identifier">RightDistributivity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,-,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">c</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span>
<span class="identifier">RightDistributivity</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,&amp;,-,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">&amp;</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">-</span> <span class="identifier">c</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span>
</pre>
<p>
      </p>
<p>
        Results for the distributivity laws are almost identical to the validation
        of sets except that for a <code class="computeroutput"><span class="identifier">partial_enricher</span>
        <span class="identifier">map</span></code> the law <code class="computeroutput"><span class="special">(</span><span class="identifier">a</span> <span class="special">&amp;</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">-</span>
        <span class="identifier">c</span> <span class="special">==</span>
        <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span>
        <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span></code> holds for lexicographical equality.
      </p>
<p>
        
</p>
<pre class="programlisting">                                                   <span class="special">+,&amp;</span>    <span class="special">&amp;,+</span>
     <span class="identifier">Distributivity</span>  <span class="identifier">joining</span>                       <span class="special">==</span>     <span class="special">==</span>
                     <span class="identifier">splitting</span>   <span class="identifier">partial_absorber</span>  <span class="special">=</span><span class="identifier">e</span><span class="special">=</span>    <span class="special">=</span><span class="identifier">e</span><span class="special">=</span>
                                 <span class="identifier">partial_enricher</span>  <span class="special">=</span><span class="identifier">e</span><span class="special">=</span>    <span class="special">==</span>                     
                     
                                                   <span class="special">+,-</span>    <span class="special">&amp;,-</span>
<span class="identifier">RightDistributivity</span>  <span class="identifier">joining</span>                       <span class="special">==</span>     <span class="special">==</span>
                     <span class="identifier">splitting</span>                     <span class="special">=</span><span class="identifier">e</span><span class="special">=</span>    <span class="special">==</span>
</pre>
<p>
      </p>
<a name="boost_icl.semantics.collectors__maps_of_sets.demorgan_s_law_and_symmetric_difference"></a><h6>
<a name="id1091906"></a>
        <a class="link" href="collectors__maps_of_sets.html#boost_icl.semantics.collectors__maps_of_sets.demorgan_s_law_and_symmetric_difference">DeMorgan's
        Law and Symmetric Difference</a>
      </h6>
<p>
        
</p>
<pre class="programlisting"><span class="identifier">DeMorgan</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,+,&amp;,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span> <span class="special">-</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">+</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span>
<span class="identifier">DeMorgan</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,&amp;,+,=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="identifier">a</span> <span class="special">-</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">&amp;</span> <span class="identifier">c</span><span class="special">)</span> <span class="special">=</span><span class="identifier">v</span><span class="special">=</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">c</span><span class="special">)</span>
</pre>
<p>
      </p>
<p>
        
</p>
<pre class="programlisting">                         <span class="special">+,&amp;</span>     <span class="special">&amp;,+</span>
<span class="identifier">DeMorgan</span>  <span class="identifier">joining</span>        <span class="special">==</span>      <span class="special">==</span>
          <span class="identifier">splitting</span>      <span class="special">==</span>      <span class="special">=</span><span class="identifier">e</span><span class="special">=</span>
</pre>
<p>
      </p>
<p>
        
</p>
<pre class="programlisting"><span class="identifier">SymmetricDifference</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,==</span> <span class="special">&gt;</span> <span class="special">:</span> <span class="identifier">C</span> <span class="identifier">a</span><span class="special">,</span><span class="identifier">b</span><span class="special">,</span><span class="identifier">c</span><span class="special">;</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">+</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">-</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">*</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">a</span> <span class="special">-</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">+</span> <span class="special">(</span><span class="identifier">b</span> <span class="special">-</span> <span class="identifier">a</span><span class="special">)</span>
</pre>
<p>
      </p>
<p>
        Reviewing the validity tables above shows, that the sets of valid laws for
        <code class="computeroutput"><span class="identifier">icl</span> <span class="identifier">Sets</span></code>
        and <code class="computeroutput"><span class="identifier">icl</span> <span class="identifier">Maps</span>
        <span class="identifier">of</span> <span class="identifier">Sets</span></code>
        that are <span class="emphasis"><em>identity absorbing</em></span> are exactly the same. As
        expected, only for Maps of Sets that represent empty sets as associated values,
        called <span class="emphasis"><em>identity enrichers</em></span>, there are marginal semantic
        differences.
      </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2007 -2010 Joachim Faulhaber<br>Copyright &#169; 1999 -2006 Cortex Software GmbH<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="maps.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../semantics.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="quantifiers__maps_of_numbers.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
